const debug = require('debug')('bus-crowdsrc:model definition');
const fs = require('fs');
const path = require('path');
const models_folder = path.dirname(__filename);
debug(`folder of model definitions is [${models_folder}]`);
let definitions = {};
fs.readdirSync(models_folder).forEach((item, ind, arr) => {
    if (item !== 'index.js' && item.endsWith('.js')) {
        debug(`file loaded[${item}]`);
        let name = path.basename(item, '.js');
        let model_def = require(path.join(models_folder, item));
        definitions[name] = model_def;
    }
});
module.exports = definitions;
